<?php


namespace libs\init;


use epii\orm\Db;
use epii\server\i\IRun;
use epii\server\Response;
use epii\server\Tools;

class databaseInit implements IRun
{
    public function run()
    {
        if (file_exists($db_config = Tools::getVendorDir() . "/../config/db.conf.php")) {

            $config = include $db_config;
            $config["schema_path"] = Tools::getRuntimeDirectory() . "/cache/filed_cache/";
            Db::setConfig($config);
        } else {
            Response::error($db_config . " is not find!");
        }
    }
}